function [filename] = parse_filename(fpath, filen)
% function to parse filename in system-dependent manner from the dfile structure.
% alg:
% if PCWIN: filename = drive:path\filename where path comes from the control matrix, and drive: comes
%  from the GUI
% if LNX86: filename = path/filename
%
[gdrive,gpath,gext] = getdriveext; % get the drive path and extension from the gui window
OS=computer;
%OS='PCWIN';
switch (OS)
case 'PCWIN'
   [path, name, ext, ver] = fileparts(filen); % separate the filename into its part
   	drive = sprintf('%1s:',char(gdrive+64));
	newpath=[drive, fpath];
    filename = fullfile(fpath, [name, ext]);
%	QueMessage(sprintf('P:file %s drive: %s', filename));

case 'LNX86'
	[path, name, ext, ver] = fileparts(filen); % separate the filename into its parts
	filename = fullfile(fpath, filen);
otherwise
	filename = fullfile(fpath, filen);
end
return;
	
	
